package com.xxx.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xxx.pojo.Account;
import com.xxx.pojo.User;
import com.xxx.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/8/25 15:47
 * @Copyright 博为峰
 */
@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @ResponseBody
    @RequestMapping("/getUserList")
    public PageInfo<User> getUserList(@RequestParam("currentpage") int pageNum, @RequestParam("pagesize") int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        final List<User> userList = userService.getUserList();
        final PageInfo<User> pageInfo = new PageInfo<>(userList);
        return pageInfo;
    }
}
